<template>
  <div class="main">
    <div ref="stickyHeader" v-sticky style="background:#F4F7FD;">
      <navTop></navTop>
      <div class="contentboxset">
        <div class="breadBox" :style="screenWidth > 1400 ? 'width:1400px;;' : 'width:1200px;min-width:1200px;'">
          <el-breadcrumb separator="/">
            <el-breadcrumb-item>作业</el-breadcrumb-item>
            <el-breadcrumb-item>成绩管理</el-breadcrumb-item>
          </el-breadcrumb>
        </div>
      </div>
      <div style="margin-top:15px;"></div>
      <secondNav :style="screenWidth > 1400 ? 'width:1400px;' : 'width:1200px;min-width:1200px;'"></secondNav>
      <div style="background:#F4F7FD;margin:0 auto;"
        :style="screenWidth > 1400 ? 'width:1400px;;' : 'width:1200px;min-width:1200px;'">
        <div class="searchlist">
          <div>
            <div style="display: flex;align-items: center;">
              <span>学科：</span>
              <el-select v-model="courseId" placeholder="全部" @change="classsifychange" clearable>
                <el-option key="0" label="全部" value="0">
                </el-option>
                <el-option v-for="item in subjectlist" :key="item.id" :label="item.name" :value="item.id">
                </el-option>
              </el-select>
              <span>年级：</span>
              <el-select v-model="gradeId" placeholder="全部" @focus="gradelistfocus" @change="gradelistchange" clearable>
                <el-option key="0" label="全部" value="0">
                </el-option>
                <el-option v-for="item in gradelist" :key="item.id" :label="item.name" :value="item.id">
                </el-option>
              </el-select>
              <span>班级：</span>
              <el-select v-model="classId" placeholder="全部" @change="classlistchange" clearable>
                <el-option key="0" label="全部" value="0">
                </el-option>
                <el-option v-for="item in classlist" :key="item.id" :label="item.name" :value="item.id">
                </el-option>
              </el-select>
              <span>时间：</span>
              <div class="inputBox" style="width:300px;position:relative">
                <el-date-picker @change="datapickchange" clearable v-model="examdate" type="daterange"
                  range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
                  :default-time="['00:00:00', '23:59:59']" clearable>
                </el-date-picker>
                <!-- <div class="dataicon">
                  <img src="../../assets/image/school/data.png" alt="">
                </div> -->
              </div>
            </div>
            <div style="display: flex;align-items: center;" class="searchbox">
              <span>搜索：</span>
              <el-input v-model="examobj.query.name" placeholder="输入作业名称" @keyup.enter.native="searchbox"></el-input>
              <i @click="searchbox" style="cursor: pointer;"><img src="../../assets/image/school/search.png" alt=""
                  style="width:16px;height:16px;margin-top:9px;"></i>
            </div>
          </div>
          <em
            style="display:inline-block;background:#295CFF;color:#fff;border-radius: 10px;height:40px;line-height:40px;padding:0 15px;cursor:pointer;font-size:14px;"
            @click="showscoredb">生成对比/总结分析</em>
        </div>
      </div>
    </div>
    <div class="contentMain" v-if="examlist && examlist.length > 0">
      <div class="contentMainlist" v-for="(item, index) in examlist" :key="item.id"
        :style="screenWidth > 1400 ? 'width:1400px;;' : 'width:1200px;min-width:1200px;'">
        <div class="homeworkliststyle">
          <div class="boxsettimetitle">
            <h3>{{ item.name }}</h3>
            <p>
              时间：{{ item.startTime ? item.startTime.split(' ')[0] : ''}}&nbsp;&nbsp;&nbsp;&nbsp;年级：{{ item.studentRange && item.studentRange.length > 0 ?
                item.studentRange[0].gradeName : '-' }}&nbsp;&nbsp;&nbsp;&nbsp;类型：{{ item.examType == 1 ? '作业' :
                item.examType == 2 ? '月考' : item.examType == 3 ? '期中考试' : item.examType == 4 ? '期末考试' : '其他'
              }}&nbsp;&nbsp;&nbsp;&nbsp;阅卷方式：{{
                item.markHubType == 1 ? '全校阅卷' : item.markHubType == 2 ? '分班阅卷' : item.markHubType == 3 ? '导入成绩' :
                  item.markHubType == 4 ? '先阅后扫' : '线上考试'
              }}</p>
          </div>
          <table cellpadding="0" cellspacing="0" border="0" class="tablestyle">
            <tr>
              <th>考试科目</th>
              <th>班级数量</th>
              <th>已上传</th>
              <th>未上传</th>
              <th>平均分</th>
              <th>最高分</th>
              <th>最低分</th>
              <th>操作</th>
            </tr>
            <tr v-for="(course, num) in item.examCourses" :key="course.id">
              <td>{{ course.coursesName }}</td>
              <td>{{ course.classCount }}</td>
              <td>{{ course.studentTotal - course.missExamTotal }}</td>
              <td>{{ course.missExamTotal }}</td>
              <td>{{ course.avgScore.toFixed(2) }}</td>
              <td>{{ course.highestScore }}</td>
              <td>{{ course.lowestScore }}</td>
              <td width="490">
                <div class="qxboxset" v-click-outside="closeDialog">
                  <!-- 本次错题 -->
                  <div>
                    <div style="margin-top:0;" v-if="course.analysisLoading" class="loading-text">生成中<b
                        class="dotting"></b></div>
                    <div style="margin-top:0;" v-if="!course.analysisLoading">
                      <span @click.stop="messboxclick(item.id, index, num)" class="errorred">本次错题<i
                          class="el-icon-arrow-down el-icon--right"></i></span>
                      <ul class="ulbox" v-if="course.messboxishow">
                        <b>选择班级</b>
                        <li v-for="items in classlistbox" :key="items.id"
                          @click.stop="messboxcontent(items.studentCount, items.gradeId, course.coursesName, item.name, item.id, items.classId, items.gradeName, items.className, course.id, '/errorwork', index, num,items.omsClassId,'本次错题',items.omsGradeId)">
                          {{ items.gradeName }}{{ items.className }}<i>{{ items.studentCount }}</i></li>
                      </ul>
                    </div>
                  </div>
                  <div>
                    <div style="margin-top:0;" v-if="course.analysisLoading1" class="loading-text">生成中<b
                        class="dotting"></b></div>
                    <div style="margin-top:0;" v-if="!course.analysisLoading1">
                      <span @click.stop="messboxclick1(item.id, index, num,item.name,course.id)">学情分析<i
                          class="el-icon-arrow-down el-icon--right"></i></span>
                      <ul class="ulbox" v-if="course.messboxishow1">
                        <b>选择班级</b>
                        <!-- <li v-for="items in classlistbox" :key="items.id"
                            @click.stop="messboxcontent(items.studentCount, items.gradeId, course.coursesName, item.name, item.id, items.classId, items.gradeName, items.className, course.id, 'https://ra.bsedu.com')">
                            {{ items.gradeName }}{{ items.className }}<i>{{ items.studentCount }}</i></li> -->
                        <li v-for="items in classlistbox" :key="items.id"
                          @click.stop="messboxcontent(items.studentCount, items.gradeId, course.coursesName, item.name, item.id, items.classId, items.gradeName, items.className, course.id, $linkUrlra, index, num,items.omsClassId,'学情分析',items.omsGradeId)">
                          {{ items.gradeName }}{{ items.className }}<i>{{ items.studentCount }}</i></li>
                      </ul>
                    </div>
                  </div>
                  <div>
                    <div style="margin-top:0;" v-if="course.analysisLoading2" class="loading-text">生成中<b
                        class="dotting"></b></div>
                    <div style="margin-top:0;" v-if="!course.analysisLoading2">
                      <span @click.stop="messboxclick2(item.id, index, num)">在线讲评<i
                          class="el-icon-arrow-down el-icon--right"></i></span>
                      <ul class="ulbox" v-if="course.messboxishow2">
                        <b>选择班级</b>
                        <!-- <li v-for="items in classlistbox" :key="items.id"
                          @click.stop="messboxcontent(items.studentCount, items.gradeId, course.coursesName, item.name, item.id, items.classId, items.gradeName, items.className, course.id, 'https://wb.bsedu.com')">
                          {{ items.gradeName }}{{ items.className }}<i>{{ items.studentCount }}</i></li> -->
                        <li v-for="items in classlistbox" :key="items.id"
                          @click.stop="messboxcontent(items.studentCount, items.gradeId, course.coursesName, item.name, item.id, items.classId, items.gradeName, items.className, course.id, $linkUrlwb, index, num,items.omsClassId,'在线讲评',items.omsGradeId)">
                          {{ items.gradeName }}{{ items.className }}<i>{{ items.studentCount }}</i></li>
                      </ul>
                    </div>
                  </div>
                  <!-- <div v-click-outside="closeDialog">
                    <span @click.stop="messboxclick3(item.id, index, num)">学生查分<i class=" el-icon-arrow-down
                      el-icon--right"></i></span>
                    <div class="phoneimagecontent" v-if="course.phoneImageishow">
                      <img src="../../assets/image/school/phoneimage.png" alt="学生查分二维码">
                      <b>点击二维码复制该图片</b>
                    </div>
                  </div> -->
                </div>
              </td>
            </tr>
          </table>
        </div>
      </div>
    </div>
    <div style="height:70px;"></div>
    <div class="examfooter">
      <div class="examFootercontent" :style="screenWidth > 1400 ? 'width:1400px;;' : 'width:1200px;min-width:1200px;'">
        <span class="totaldata">共<i>{{ total }}</i>条数据</span>
        <div>
          <el-pagination background @current-change="handleCurrentChange" :page-sizes="[10, 50, 100]"
            @size-change="handleSizeChange" :page-size="examobj.pageSize" layout="sizes, prev, pager, next"
            :total="total">
          </el-pagination>
        </div>
      </div>
    </div>
    <!-- 生成对比分析 -->
    <div class="Generatecomparativeanalysis" v-if="scoreishow">
      <div class="GeneratecomparativeanalysisContent">
        <h3>生成对比/总结分析</h3>
        <!-- <span>输入分析名次（可自动命名）</span>
                <el-input v-model="fxtitle" placeholder="请输入内容"></el-input> -->
        <span>请选择分析科目</span>
        <el-select v-model="assynclistsubjectid" placeholder="请选择">
          <el-option v-for="item in subjectlistsass" :key="item.id" :label="item.name" :value="item.id">
          </el-option>
        </el-select>
        <!-- <span>选择分析类型</span>
                <el-checkbox-group v-model="checkList">
                    <el-checkbox label="作业"></el-checkbox>
                    <el-checkbox label="考试"></el-checkbox>
                </el-checkbox-group> -->
        <span>选择分析范围（年级仅单选）</span>
        <div v-for="grade in grdegradelist" :key="grade.id">
          <!-- 年级单选 -->
          <div style="display: flex; align-items: center;padding:15px 0 5px;">
            <el-radio v-model="selectedGradeId" :label="grade.id" @change="handleGradeChange(grade.id)">
              {{ grade.name }}
            </el-radio>
            <!-- 控制显示按钮 -->
            <el-button size="mini" type="text"
              :icon="showClassesForGradeId === grade.id ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"
              @click="toggleClassDisplay(grade.id)" style="margin-left: 8px; padding: 4px 8px;">
            </el-button>
            <!-- 指定班级文本，根据数据状态显示不同内容 -->
            <b style="font-weight:normal;font-size:13px;cursor: pointer;" @click="zdclasslist(grade.id)">
              {{ grade.classes && grade.classes.length > 0 ? '指定班级' : '暂无数据' }}
            </b>
            <!-- 全选checkbox，位于指定班级右侧 -->
            <el-checkbox v-if="grade.classes && grade.classes.length > 0 && showClassesForGradeId === grade.id"
              :value="isAllSelected(grade.id)" @change="toggleSelectAll(grade.id, $event)"
              style="margin-left: 10px; font-size: 13px;">
              全选
            </el-checkbox>
          </div>

          <!-- 修改班级多选框的显示条件 -->
          <div v-if="showClassesForGradeId === grade.id && grade.classes && grade.classes.length > 0">
            <!-- 班级多选框 -->
            <el-checkbox-group v-model="gradeClassSelections[grade.id]" style="margin-left: 20px;">
              <el-checkbox v-for="classItem in grade.classes" :key="classItem.id" :label="classItem.id">
                {{ classItem.name }}
              </el-checkbox>
            </el-checkbox-group>
          </div>
        </div>
        <span>选择时间范围</span>
        <el-radio-group v-model="timeRadio" @change="handleTimeRadioChange" style="padding-bottom:8px;">
          <el-radio :label="1">月度</el-radio>
          <el-radio :label="2">周度</el-radio>
          <el-radio :label="3">任选时间</el-radio>
        </el-radio-group>
        <div v-show="timeRadio == 1">
          <el-date-picker ref="monthPicker" v-model="monthinfo" type="month" placeholder="选择月" placement="top-start"
            popper-class="date-picker-popper-top" @change="monthchange">
          </el-date-picker>
        </div>
        <div v-show="timeRadio == 2">
          <el-date-picker ref="weekPicker" v-model="weekinfo" type="week" format="yyyy 第 WW 周" placeholder="选择周"
            placement="top-start" popper-class="date-picker-popper-top" @change="handleWeekChange">
          </el-date-picker>
        </div>
        <div v-show="timeRadio == 3">
          <el-date-picker ref="rangePicker" v-model="datainfo" type="daterange" range-separator="至"
            start-placeholder="开始日期" end-placeholder="结束日期" placement="top-start" popper-class="date-picker-popper-top"
            @change="handleDateChange">
          </el-date-picker>
        </div>
        <div class="buttonbox">
          <em @click="Generateanalysis">生成成绩</em>
          <em @click="scoreishow = false">返回</em>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import navTop from "../../components/homework/headtop.vue"
import secondNav from "../../components/homework/secondnav.vue"
import examEdite from '../../components/school/exditexam.vue'
import examCopy from '../../components/school/copyexam.vue'
import { get, post, del, put, dele, analsisget, getanalysis } from '../../request/api.js'
import empty from '../../components/school/empty.vue'
import { mapGetters } from 'vuex';
export default {
  computed: {
    ...mapGetters(['getScreenWidth']),
    screenWidth() {
      return this.getScreenWidth;
    },
  },
  data() {
    return {
      searchInput: '',
      time: '',
      classify: '',
      grade: '',
      status: '',
      timelist: ['2024年', '2023年'],
      classifylist: [
        { name: '全部', id: '0' },
        { name: '作业/测验', id: 1 },
        { name: '月考', id: 2 },
        { name: '期中', id: 3 },
        { name: '期末', id: 4 }
      ],
      gradelist: [],
      statuslist: [{ name: '开启', bolen: true }, { name: '停用', bolen: false }],
      addExamIshow: false,
      currentPage4: 4,
      examlist: [],
      examCopyIshow: false,
      examdate: '',
      total: null,
      examobj: {
        page: 1,
        pageSize: 10,
        query: {
          startTime: undefined,
          endTime: undefined,
          gradeId: 0,
          classId: 0,
          courseId: 0,
          name: '',
          examId: 0
        }
      },
      addexamtype: 0,
      stopexamlist: [],
      stoptotal: null,
      stoppage: 1,
      stoppagesize: 3,
      stopexamishow: false,
      classlist: [],
      subjectlist: [],
      gradeId: '',
      classId: '',
      courseId: '',
      subjectid: 0,
      checkList: ['作业'],
      checkAll: false,
      checkedCities: ['上海', '北京'],
      cities: ['上海', '北京', '广州', '深圳'],
      isIndeterminate: true,
      timeRadio: '',
      scoreishow: false,
      messboxishow: false,
      messboxishow1: false,
      messboxishow2: false,
      loading: false,
      classlistbox: [],
      assynclistsubjectid: '',
      grdegradelist: [],
      // 新增数据项
      selectedGradeId: null,  // 当前选中的年级ID
      selectedClassIds: [],   // 当前选中的班级ID数组
      monthinfo: '',
      weekinfo: '',
      datainfo: '',
      startTime: '',
      endTime: '',
      fxtitle: '',
      subjectlistsass: [],
      gradeidqh: 0,
      showClassesForGradeId: null,
      isClearable: true,
      pickerKey: 0,
      observer: null,
      gradeidnew: '',
      gradeClassSelections: {}, // 存储每个年级的班级选择状态
      isLoggedIn: false,
      dataLoaded: false,
      componentKey: 0,
      analysisLoading: false,
      fbnumStatus: 0
    }
  },
  async mounted() {
    if (this.$route.query.title) {
      this.examobj.query.name = this.$route.query.title
    }
    // 获取考试列表
    await this.examclicklist()
    await this.subjectlisttab()
    await this.gradeboxlist()
    await this.sasssubjectlistab()
    this.dataLoaded = true;
    this.componentKey++; // 强制刷新子组件

  },
  beforeDestroy() {

  },
  methods: {
    closeDialog() {
      // 先重置所有弹窗状态
      this.examlist.forEach(item => {
        item.examCourses.forEach(course => {
          course.messboxishow = false
          course.messboxishow1 = false
          course.messboxishow2 = false
          course.phoneImageishow = false
        })
      });
    },
    handleDateChange1(value) {
      if (value[0].getTime() === value[1].getTime()) {
        this.pickerKey += 1; // 强制重新渲染
      }
      if (value != null) {
        this.startTime = value[0]
        this.endTime = value[1]
        this.examclicklist()
      } else {
        this.startTime = undefined
        this.endTime = undefined
        this.examclicklist()
      }
    },
    // 新增指定班级点击方法
    zdclasslist(gradeId) {
      // 如果该年级没有班级数据，直接返回
      const grade = this.grdegradelist.find(g => g.id === gradeId);
      if (!grade || !grade.classes || grade.classes.length === 0) {
        this.$message.warning('该年级暂无班级数据');
        return;
      }

      // 如果点击的不是当前选中的年级，先切换年级
      if (this.selectedGradeId !== gradeId) {
        this.selectedGradeId = gradeId;
        this.gradeidqh = gradeId;
        // 清空所有年级的选择状态
        this.gradeClassSelections = {};
        // 设置为全选状态（但不展开）
        this.$set(this.gradeClassSelections, gradeId, grade.classes.map(item => item.id));
      }

      this.showClassesForGradeId = this.showClassesForGradeId === gradeId ? null : gradeId;

      // 展开时取消全选状态，变为单独选择状态（空数组）
      if (this.showClassesForGradeId === gradeId) {
        this.$set(this.gradeClassSelections, gradeId, []);
      }
    },
    // 新增辅助方法：获取周数
    getWeekNumber(date) {
      const firstDayOfYear = new Date(date.getFullYear(), 0, 1);
      const pastDaysOfYear = (date - firstDayOfYear) / 86400000;
      return Math.ceil((pastDaysOfYear + firstDayOfYear.getDay() + 1) / 7);
    },
    //生成分析报告
    Generateanalysis() {
      // 新增参数校验
      if (!this.assynclistsubjectid) {
        this.$message.error('请选择分析科目');
        return;
      }
      if (!this.selectedGradeId) {
        this.$message.error('请选择分析年级');
        return;
      }
      if (!this.startTime || !this.endTime) {
        this.$message.error('请选择完整的时间范围');
        return;
      }

      // 获取当前选中年级的班级ID数组
      const currentSelectedClassIds = this.gradeClassSelections[this.selectedGradeId] || [];

      // 确保monthinfo是有效的Date对象
      let monthTitle = '';
      if (this.timeRadio === 1 && this.monthinfo instanceof Date) {
        monthTitle = `${this.monthinfo.getFullYear()}年${this.monthinfo.getMonth() + 1}月`;
      }
      // 确保weekinfo是有效的Date对象
      else if (this.timeRadio === 2 && this.weekinfo instanceof Date) {
        monthTitle = `${this.weekinfo.getFullYear()}年第${this.getWeekNumber(this.weekinfo)}周`;
      }
      else {
        monthTitle = `${this.startTime}-${this.endTime}`;
      }

      let subjectname = this.subjectlistsass.filter(item => item.id === this.assynclistsubjectid)
      let gradename = this.grdegradelist.filter(item => item.id === this.gradeidqh)

      this.fxtitle = `${subjectname[0].name}${gradename[0].name}多班${monthTitle}`;

      const params = new URLSearchParams({
        title: encodeURIComponent(this.fxtitle),
        subjectid: this.assynclistsubjectid,
        gradeid: this.selectedGradeId,
        classids: currentSelectedClassIds.join(','), // 使用新的班级选择数据
        startTime: this.startTime,
        endTime: this.endTime,
        datainfo: this.datainfo,
        // fiverate:JSON.stringify(res.data[0].academiclevels)
      }).toString();
      // 调试输出（完成后可删除）
      //console.log('请求参数：', params);
      let obj = {
        subjectId: this.assynclistsubjectid,
        gradeId: this.selectedGradeId,
        classIds: currentSelectedClassIds.join(','),
        startTime: this.startTime,
        endTime: this.endTime,
      }
      getanalysis('/api/score/homework-submit-comparison', obj).then(res => {
        console.info(res)
        if (res.code == 200 && res.data.length == 0 || res.code == 500) {
          this.$message.error('暂无分析数据')
        } else {
          if (this.timeRadio == 1 || this.timeRadio == 2) {
            this.scoreishow = false
            // window.location.href = `https://ra.bsedu.com/singlegradeScoreanalysis?${params}`;
            window.location.href = `${this.$linkUrlra}/singlegradeScoreanalysis?${params}`;

          } else {
            this.scoreishow = false
            // window.location.href = `https://ra.bsedu.com/gradeScoreAnalysis?${params}`;
            window.location.href = `${this.$linkUrlra}/gradeScoreAnalysis?${params}`;
          }
        }
      })
      // }
      // })
    },
    //月
    monthchange(val) {
      if (!val) return;

      // 开始时间：当月1号（格式：YYYY-MM-DD）
      const startDate = new Date(val.getFullYear(), val.getMonth(), 1);
      const startTime = this.formatDate(startDate); // 输出：2025-05-01

      // 结束时间：当月最后一天（格式：YYYY-MM-DD）
      const endDate = new Date(val.getFullYear(), val.getMonth() + 1, 0);
      const endTime = this.formatDate(endDate); // 输出：2025-05-31

      //console.log('开始时间:', startTime);
      //console.log('结束时间:', endTime);

      // 存储到 data 中
      this.startTime = startTime;
      this.endTime = endTime;
    },
    handleWeekChange(val) {
      if (!val) return;
      //console.info('val',val)
      // 获取选中周的周一（开始日期）
      const startDate = this.getWeekStart(val);
      // 获取选中周的周日（结束日期）
      const endDate = this.getWeekEnd(val);
      //console.info('endDate',endDate)
      // 格式化为 YYYY-MM-DD
      this.startTime = this.formatDate(startDate);
      this.endTime = this.formatDate(endDate);

      //console.log('周开始时间:', this.startTime);
      //console.log('周结束时间:', this.endTime);
    },
    // 获取周一的日期
    getWeekStart(date) {
      const day = date.getDay(); // 0是周日，1是周一...6是周六
      const diff = date.getDate() - day + (day === 0 ? -6 : 1); // 调整到周一
      return new Date(date.setDate(diff));
    },
    // 获取周日的日期
    getWeekEnd(date) {
      const start = this.getWeekStart(date);
      const end = new Date(start);
      end.setDate(start.getDate() + 6); // 周一 + 6天 = 周日
      return end; // 添加返回值
    },
    handleDateChange(val) {
      if (!val || val.length !== 2) return;

      // 获取开始日期和结束日期（Date 对象）
      const [start, end] = val;

      // 格式化为 YYYY-MM-DD
      this.startTime = this.formatDate(start);
      this.endTime = this.formatDate(end);

      //console.log('开始日期:', this.startTime);
      //console.log('结束日期:', this.endTime);
    },
    // 辅助方法：格式化日期为 YYYY-MM-DD
    formatDate(date) {
      const year = date.getFullYear();
      const month = String(date.getMonth() + 1).padStart(2, '0');
      const day = String(date.getDate()).padStart(2, '0');
      return `${year}-${month}-${day}`;
    },
    // 新增方法
    handleGradeChange(gradeId) {
      // 切换年级时清空其他年级的选择
      this.gradeidqh = gradeId;
      let classlist = this.grdegradelist.filter(item => item.id === gradeId)

      // 切换年级时，收起所有年级的班级选择区域
      this.showClassesForGradeId = null;

      // 清空所有年级的班级选择状态
      this.gradeClassSelections = {};

      if (classlist.length > 0 && classlist[0].classes) {
        // 选中年级时，默认为班级全选状态，但不自动展开指定班级
        if (classlist[0].classes.length > 0) {
          // 设置为全选状态
          this.$set(this.gradeClassSelections, gradeId, classlist[0].classes.map(item => item.id));
          // 注意：这里不设置 this.showClassesForGradeId = gradeId，所以不会自动展开
        }
      }
    },
    handleClassChange(gradeId, classIds) {
      // 保持响应式更新
      this.$set(this.gradeClasses, gradeId, classIds);
    },
    //获取年级下所有的列表
    gradeboxlist() {
      get('/period/alllist').then(res => {
        if (res.code == 200) {
          // const allGrades = res.data.flatMap(item => item.grades);
          // this.grdegradelist = allGrades;

          const allGrades = res.data.flatMap(item => item.grades);
          this.grdegradelist = allGrades;

          // 取消默认选中年级，让用户自己选择
          this.selectedGradeId = null;
          this.gradeidqh = 0;

          // 取消默认展开，初始状态不展开任何年级的班级选择
          this.showClassesForGradeId = null;

          // 清空班级选择状态
          this.gradeClassSelections = {};

        } else {
          this.$message.error(res.message)
        }
      })
    },
    // 获取班级
    getclass(id) {
      let obj = {
        examId: id
      }
      get('/work/class', obj)
        .then(res => {
          if (res.code == 200) {
            this.classlistbox = res.data
          } else {
            this.$message.error(res.message);
          }
        })
    },
    // 错题本
    messboxclick(examid, parentindex, childindex) {
      this.fbnumStatus = 1
      // 先重置所有弹窗状态
      this.examlist.forEach(item => {
        item.examCourses.forEach(course => {
          course.messboxishow = false
          course.messboxishow1 = false
          course.messboxishow2 = false
          course.phoneImageishow = false
        })
      });
      this.examlist[parentindex].examCourses[childindex].messboxishow = !this.examlist[parentindex].examCourses[childindex].messboxishow
      this.getclass(examid)
    },
    messboxclick1(examid, parentindex, childindex,title,courseid) {
      //获取学科
      // let obj={
      //   examCourseId:courseid
      // }
      //  get('/course/getsubject', obj).then(subject => {
      //     if (subject.code == 200) {
      //       this.$router.push('/classreport?examId='+examid+'&title='+title+'&subjectId='+subject.data)
      //     }
      // })
      
      this.fbnumStatus = 2
      this.examlist.forEach(item => {
        item.examCourses.forEach(course => {
          course.messboxishow = false
          course.messboxishow1 = false
          course.messboxishow2 = false
          course.phoneImageishow = false
        })
      });
      this.examlist[parentindex].examCourses[childindex].messboxishow1 = !this.examlist[parentindex].examCourses[childindex].messboxishow1
      this.getclass(examid)
    },
    messboxclick2(examid, parentindex, childindex) {
      this.fbnumStatus = 3
      this.examlist.forEach(item => {
        item.examCourses.forEach(course => {
          course.messboxishow = false
          course.messboxishow1 = false
          course.messboxishow2 = false
          course.phoneImageishow = false
        })
      });
      this.examlist[parentindex].examCourses[childindex].messboxishow2 = !this.examlist[parentindex].examCourses[childindex].messboxishow2
      this.getclass(examid)
    },
    messboxclick3(examid, parentindex, childindex) {
      this.examlist.forEach(item => {
        item.examCourses.forEach(course => {
          course.messboxishow = false
          course.messboxishow1 = false
          course.messboxishow2 = false
          course.phoneImageishow = false
        })
      });
      this.examlist[parentindex].examCourses[childindex].phoneImageishow = !this.examlist[parentindex].examCourses[childindex].phoneImageishow
    },
    // 学成分析
    // messboxcontent (studentNumber, gradeid, sujectname, titlename, examid, id, gradename, classname, courseid, urllink) {
    //   //console.info('studentNumber',studentNumber)
    //   // //console.info(courseid+'------'+examid)
    //   if (studentNumber > 0) {
    //     this.loading = true
    //     let obj = {
    //       examCourseId: courseid
    //     }
    //     get('/course/getsubject', obj).then(subject => {
    //       if (subject.code == 200) {
    //         get('/work/workpushstate', obj)
    //           .then(res => {
    //             if (res.code == 200) {
    //               if (res.data == 3) {
    //                 let title = titlename + '-' + sujectname + '-' + gradename + '-' + classname
    //                 analsisget(`/api/class/get/${examid}`, { classId: id })
    //                   .then(anysis => {
    //                     // //console.info(anysis)
    //                     if (anysis.code == 200) {
    //                       if (anysis.data.status == 2) {
    //                         if (urllink.includes('https')) {
    //                           window.location.href = `${urllink}?examId=${examid}&classId=${id}&title=${title}&subjectid=${subject.data}&gradeid=${gradeid}&courseid=${courseid}`
    //                         } else {
    //                           this.$router.push(`${urllink}?examId=${examid}&classId=${id}&title=${title}&subjectid=${subject.data}&gradeid=${gradeid}&courseid=${courseid}`)
    //                         }
    //                       } else {
    //                         this.$message.error('当前分析未加载完成')
    //                       }
    //                     } else {
    //                       this.$message.error(res.message);
    //                     }
    //                   })
    //               } else if(res.data == 5){
    //                 this.analysisLoading=true
    //               } else {
    //                 const formData = new FormData();
    //                 formData.append('courseId', courseid);
    //                 post('/score/publishscore', formData, {
    //                   headers: {
    //                     'Content-Type': 'application/x-www-form-urlencoded'
    //                   }
    //                 })
    //                   .then(res => {
    //                     if (res.code == 200) {
    //                       let title = titlename + '-' + sujectname + '-' + gradename + '-' + classname
    //                       analsisget(`/api/class/get/${examid}`, { classId: id })
    //                         .then(anysis => {
    //                           if (anysis.code == 200) {
    //                             if (anysis.data.status == 2) {
    //                               if (urllink.includes('https')) {
    //                                 window.location.href = `${urllink}?examId=${examid}&classId=${id}&title=${title}&subjectid=${subject.data}&gradeid=${gradeid}&courseid=${courseid}`
    //                               } else {
    //                                 this.$router.push(`${urllink}?examId=${examid}&classId=${id}&title=${title}&subjectid=${subject.data}&gradeid=${gradeid}&courseid=${courseid}`)
    //                               }
    //                             } else {
    //                               this.$message.error('当前分析未加载完成')
    //                             }
    //                           } else {
    //                             this.$message.error(res.message);
    //                           }
    //                         })
    //                     } else {
    //                       this.$message.error(res.message)
    //                     }
    //                   })
    //               }
    //             }
    //           })
    //       }
    //     })
    //   } else {
    //     this.$message.error('该班级没有人提交成绩，无法分析/显示错题/无法使用在线讲评')
    //   }
    // },
    messboxcontent(studentNumber, gradeid, sujectname, titlename, examid, id, gradename, classname, courseid, urllink, index, num,omsclassid,nametitle,omsGradeid) {
      const userinfo = localStorage.getItem("token");
      if (studentNumber > 0) {
        this.loading = true;
        let obj = { examCourseId: courseid };

        // 1. 先获取学科信息
        get('/course/getsubject', obj).then(subject => {
          if (subject.code == 200) {
            // 2. 开始轮询工作状态
            get('/work/workpushstate', obj).then(res => {
              // alert('dddd')
              // return false
              if (res.code == 200) {
                // 情况1：状态为3 → 停止轮询并跳转
                if (res.data == 3) {
                  this.handleSuccessState(examid, id, titlename, sujectname, gradename, classname, urllink, subject.data, gradeid, courseid,omsclassid,nametitle,omsGradeid);
                }
                // 情况2：状态为5 → 显示加载中
                else if (res.data == 5) {
                  this.examlist.forEach(item => {
                    item.examCourses.forEach(course => {
                      course.analysisLoading = false
                      course.analysisLoading1 = false
                      course.analysisLoading2 = false
                    })
                  });
                  if (this.fbnumStatus == 1) {
                    this.examlist[index].examCourses[num].analysisLoading = true
                  } else if (this.fbnumStatus == 2) {
                    this.examlist[index].examCourses[num].analysisLoading1 = true
                  } else {
                    this.examlist[index].examCourses[num].analysisLoading2 = true
                  }
                  const pollInterval = setInterval(() => {
                    get('/work/workpushstate', obj).then(res => {
                      // alert('dddd')
                      // return false
                      if (res.code == 200) {
                        // 情况1：状态为3 → 停止轮询并跳转
                        if (res.data == 3) {
                          clearInterval(pollInterval); // 清除轮询
                          this.handleSuccessState(examid, id, titlename, sujectname, gradename, classname, urllink, subject.data, gradeid, courseid,omsclassid,nametitle,omsGradeid);
                        }
                        // 情况2：状态为5 → 显示加载中
                        else if (res.data == 5) {
                          this.examlist.forEach(item => {
                            item.examCourses.forEach(course => {
                              course.analysisLoading = false
                              course.analysisLoading1 = false
                              course.analysisLoading2 = false
                            })
                          });
                          if (this.fbnumStatus == 1) {
                            this.examlist[index].examCourses[num].analysisLoading = true
                          } else if (this.fbnumStatus == 2) {
                            this.examlist[index].examCourses[num].analysisLoading1 = true
                          } else {
                            this.examlist[index].examCourses[num].analysisLoading2 = true
                          }
                        } else {
                          if (this.fbnumStatus == 1) {
                            this.examlist[index].examCourses[num].analysisLoading = true
                          } else if (this.fbnumStatus == 2) {
                            this.examlist[index].examCourses[num].analysisLoading1 = true
                          } else {
                            this.examlist[index].examCourses[num].analysisLoading2 = true
                          }
                          clearInterval(pollInterval); // 清除轮询
                          const formData = new FormData();
                          formData.append('courseId', courseid);
                          post('/score/publishscore', formData, {
                            headers: {
                              'Content-Type': 'application/x-www-form-urlencoded'
                            }
                          })
                            .then(res => {
                              if (res.code == 200) {
                                let title = titlename + '-' + sujectname + '-' + gradename + '-' + classname
                                analsisget(`/api/class/get/${examid}`, { classId: id })
                                  .then(anysis => {
                                    if (anysis.code == 200) {
                                      this.examlist.forEach(item => {
                                        item.examCourses.forEach(course => {
                                          course.analysisLoading = false
                                          course.analysisLoading1 = false
                                          course.analysisLoading2 = false
                                        })
                                      });
                                      if (anysis.data.status == 2) {
                                        if (urllink.includes('https')) {
                                          if(nametitle=='学情分析'){
                                            this.$router.push(`/classreport?examId=${examid}&classId=${id}&title=${title}&subjectid=${subject.data}&gradeid=${gradeid}&courseid=${courseid}&omsclassId=${omsclassid}&classname=${classname}`)
                                          }else{
                                            window.location.href = `${urllink}?examId=${examid}&classId=${id}&title=${title}&subjectid=${subject.data}&gradeid=${gradeid}&courseid=${courseid}`
                                          }
                                        } else {
                                          // this.$router.push(`${urllink}?examId=${examid}&classId=${id}&title=${title}&subjectid=${subject.data}&gradeid=${gradeid}&courseid=${courseid}`)
                                          window.location.href =`${this.$linkUrlzj}wrongQuestion?tabIndex=1&examId=${examid}&classId=${omsclassid}&classname=${classname}`
                                        }
                                      } else {
                                        this.$message.error('当前分析未加载完成')
                                      }
                                    } else {
                                      this.$message.error(res.message);
                                    }
                                  })
                              } else {
                                this.$message.error(res.message)
                              }
                            })
                        }
                        // 其他状态：继续轮询（不处理）
                      }
                    }).catch(err => {
                      clearInterval(pollInterval);
                      this.$message.error('轮询请求失败: ' + err.message);
                    });
                  }, 2000); // 每2秒轮询一次

                  // 3. 组件销毁时清除轮询（避免内存泄漏）
                  this.$once('hook:beforeDestroy', () => {
                    clearInterval(pollInterval);
                  });
                  // this.uploadfbstatus(studentNumber, gradeid, sujectname, titlename, examid, id, gradename, classname, courseid, urllink,index,num)
                } else {
                  if (this.fbnumStatus == 1) {
                    this.examlist[index].examCourses[num].analysisLoading = true
                  } else if (this.fbnumStatus == 2) {
                    this.examlist[index].examCourses[num].analysisLoading1 = true
                  } else {
                    this.examlist[index].examCourses[num].analysisLoading2 = true
                  }
                  const formData = new FormData();
                  formData.append('courseId', courseid);
                  post('/score/publishscore', formData, {
                    headers: {
                      'Content-Type': 'application/x-www-form-urlencoded'
                    }
                  })
                    .then(res => {
                      if (res.code == 200) {
                        let title = titlename + '-' + sujectname + '-' + gradename + '-' + classname
                        analsisget(`/api/class/get/${examid}`, { classId: id })
                          .then(anysis => {
                            if (anysis.code == 200) {
                              this.examlist.forEach(item => {
                                item.examCourses.forEach(course => {
                                  course.analysisLoading = false
                                  course.analysisLoading1 = false
                                  course.analysisLoading2 = false
                                })
                              });
                              if (anysis.data.status == 2) {
                                if (urllink.includes('https')) {
                                  if(nametitle=='学情分析'){
                                    this.$router.push(`/classreport?examId=${examid}&classId=${id}&title=${title}&subjectid=${subject.data}&gradeid=${gradeid}&courseid=${courseid}&omsclassId=${omsclassid}&classname=${classname}`)
                                  }else{
                                    window.location.href = `${urllink}?examId=${examid}&classId=${id}&title=${title}&subjectid=${subject.data}&gradeid=${gradeid}&courseid=${courseid}`
                                  }
                                } else {
                                  window.location.href =`${this.$linkUrlzj}wrongQuestion?tabIndex=1&examId=${examid}&classId=${omsclassid}&classname=${classname}`
                                  // this.$router.push(`${urllink}?examId=${examid}&classId=${id}&title=${title}&subjectid=${subject.data}&gradeid=${gradeid}&courseid=${courseid}`)
                                }
                              } else {
                                this.$message.error('当前分析未加载完成')
                              }
                            } else {
                              this.$message.error(res.message);
                            }
                          })
                      } else {
                        this.$message.error(res.message)
                      }
                    })
                }
                // 其他状态：继续轮询（不处理）
              }
            })
          }
        });
      } else {
        this.$message.error('该班级没有人提交成绩，无法分析/显示错题/无法使用在线讲评');
      }
    },
    // 提取公共跳转逻辑为独立方法
    handleSuccessState(examid, id, titlename, sujectname, gradename, classname, urllink, subjectId, gradeid, courseid,omsclassid,nametitle,omsGradeid) {
      const title = `${titlename}-${sujectname}-${gradename}-${classname}`;
      const userinfo = localStorage.getItem("token");
      analsisget(`/api/class/get/${examid}`, { classId: id }).then(anysis => {
        if (anysis.code == 200) {
          if (anysis.data.status == 2) {
            const queryParams = `?examId=${examid}&classId=${id}&title=${title}&subjectid=${subjectId}&gradeid=${gradeid}&courseid=${courseid}&omsclassId=${omsclassid}&classname=${classname}`;
            if(nametitle=='学情分析'){
              this.$router.push('/classreport'+queryParams)
            }else{
              urllink.includes('https')
              ? window.location.href = urllink + queryParams
              :window.location.href =`${this.$linkUrlzj}wrongQuestion?tabIndex=1&examId=${examid}&classId=${omsclassid}&classname=${classname}&gradeId=${omsGradeid}`
            }
          } else {
            this.$message.error('当前分析未加载完成');
          }
        } else {
          this.$message.error(anysis.message);
        }
      });
    },
    handleSelectionChange() {

    },
    showscoredb() {
      this.scoreishow = true
    },
    handleCheckAllChange(val) {
      this.checkedCities = val ? this.cities : [];
      this.isIndeterminate = false;
    },
    handleCheckedCitiesChange(value) {
      let checkedCount = value.length;
      this.checkAll = checkedCount === this.cities.length;
      this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length;
    },
    handleSizeChange(val) {
      // //console.log(`每页 ${val} 条`);
      this.examobj.pageSize = val
    },
    examclicklist() {
      this.loading = true
      this.examlist = []
      this.examobj.query.gradeId = this.gradeId == '全部' || this.gradeId == '' ? 0 : this.gradeId
      this.examobj.query.classId = this.classId == '全部' || this.classId == '' ? 0 : this.classId
      this.examobj.query.courseId = this.courseId == '全部' || this.courseId == '' ? 0 : this.courseId
      post('/score/alldetails', this.examobj)
        .then(res => {
          if (res.code == 200) {
            this.loading = false
            // let items = res.data.items.map(item => {
            //   const { examCourses, ...rest } = item; // 分离出 examCourses 和其他属性
            //   const newExamCourses = {};
            //   // 遍历 examCourses 并根据 examStage 和 markHubStatus 分类
            //   examCourses.forEach(course => {
            //     const stageKey = `subject${course.examStage}`;
            //     const statusKey = course.markHubStatus === 3 ? 'examFaish' : stageKey;
            //     if (!newExamCourses[statusKey]) {
            //       newExamCourses[statusKey] = [];
            //     }
            //     newExamCourses[statusKey].push(course);
            //   });

            //   // 合并新的属性和原始的 examCourses
            //   return { ...rest, examCourses, ...newExamCourses };
            // });
            // //console.info('items	',items)
            // this.examlist= res.data.items
            this.examlist = res.data.items.map(exam => {
              // 为每个考试科目添加状态参数
              if (exam.examCourses) {
                exam.examCourses = exam.examCourses.map(course => ({
                  ...course,
                  messboxishow: false,
                  messboxishow1: false,
                  messboxishow2: false,
                  phoneImageishow: false,
                  analysisLoading: false,
                  analysisLoading1: false,
                  analysisLoading2: false,
                }));
              }
              return exam;
            });
            // //console.info(this.examlist)
            this.total = res.data.total
          } else {
            this.$message.error(res.message);
          }
        })
    },
    // 处理每页条数变化
    handleSizeChange(val) {
      this.examobj.pageSize = val
      this.examclicklist()
    },
    // 处理当前页码变化
    handleCurrentChange(val) {
      this.examobj.page = val
      this.examclicklist()
    },
    handleCurrentChange1(val) {
      this.stoppage = val
      this.stopexambutton()
    },
    //获取年纪列表
    gradelistfocus() {
      get('/grade/list')
        .then(res => {
          // //console.info(res)
          if (res.code == 200) {
            this.gradelist = res.data
          } else {
            this.$message.error(res.message);
          }
        })
        .catch(error => {
          // 处理错误
          this.$message.error(res.message);
        });
    },
    // 考试概览
    examinfolist(subjectid, examid, examtitle, sujectname) {
      let params = {
        id: examid,
        subjectId: subjectid
      }
      sessionStorage.setItem('examContent', JSON.stringify(params))
      this.$router.push('/studentscore?subjectid=' + subjectid + '&examid=' + examid + '&examtitle=' + examtitle + '&sujectname=' + sujectname)
    },
    gradelistchange(val) {
      this.examobj.page = 1;
      if (val != 0 && val) {
        this.gradeidnew = val
        this.classlistchange()
        this.examclicklist()
      } else {
        this.classlist = [];
        this.classId = '';
        this.examclicklist()
      }
    },
    classlistchange(val) {
      this.classId = val
      if (!this.gradeidnew || this.gradeidnew === '0') {
        this.classlist = [];
        this.classId = '';
        return;
      }
      let obj = { gradeId: this.gradeidnew }
      get('/grade/classlist', obj)
        .then(res => {
          // //console.info(res)
          if (res.code == 200) {
            this.classlist = res.data
            this.examobj.page = 1;
            this.examclicklist()
          }
        })
    },
    // 获取科目列表
    subjectlisttab() {
      get('/course/alllist')
        .then(res => {
          // //console.info(res)
          if (res.code == 200) {
            this.subjectlist = res.data
          } else {
            this.$message.error(res.message);
          }
        })
    },
    //获取底座学科列表
    sasssubjectlistab() {
      get('/course/sasslist')
        .then(res => {
          if (res.code == 200) {
            this.subjectlistsass = res.data
          } else {
            this.$message.error(res.message);
          }
        })
    },
    classsifychange(val) {
      this.examobj.page = 1;
      this.examclicklist()
    },
    datapickchange(value) {
      this.examobj.page = 1;
      if (value != null) {
        this.examobj.query.startTime = value[0]
        this.examobj.query.endTime = value[1]
        this.examclicklist()
      } else {
        this.examobj.query.startTime = undefined
        this.examobj.query.endTime = undefined
        this.examclicklist()
      }
    },
    searchbox() {
      this.examobj.page = 1;
      this.examclicklist()
    },
    toggleClassDisplay(gradeId) {
      // 如果该年级没有班级数据，不进行操作
      const grade = this.grdegradelist.find(g => g.id === gradeId);
      if (!grade || !grade.classes || grade.classes.length === 0) {
        return;
      }

      this.showClassesForGradeId = this.showClassesForGradeId === gradeId ? null : gradeId;

      // 展开时确保该年级的选择状态为空数组（0选中状态）
      if (this.showClassesForGradeId === gradeId) {
        this.$set(this.gradeClassSelections, gradeId, []);
      }
    },
    toggleSelectAll(gradeId, checked) {
      const grade = this.grdegradelist.find(g => g.id === gradeId);
      if (!grade || !grade.classes || grade.classes.length === 0) {
        return;
      }

      const allClassIds = grade.classes.map(c => c.id);

      // 根据checkbox的选中状态来决定全选或取消全选
      if (checked) {
        this.$set(this.gradeClassSelections, gradeId, [...allClassIds]);
      } else {
        this.$set(this.gradeClassSelections, gradeId, []);
      }
    },
    isAllSelected(gradeId) {
      const grade = this.grdegradelist.find(g => g.id === gradeId);
      if (!grade || !grade.classes || grade.classes.length === 0) {
        return false;
      }
      const selectedIds = this.gradeClassSelections[gradeId] || [];
      return selectedIds.length === grade.classes.length;
    },
    handleTimeRadioChange(val) {
      this.timeRadio = val;

      // 使用nextTick确保DOM更新完成后再执行聚焦
      this.$nextTick(() => {
        try {
          if (val === 1 && this.$refs.monthPicker) {
            // 月度选择器聚焦
            this.$refs.monthPicker.focus();
          } else if (val === 2 && this.$refs.weekPicker) {
            // 周度选择器聚焦
            this.$refs.weekPicker.focus();
          } else if (val === 3 && this.$refs.rangePicker) {
            // 多次选择器聚焦
            this.$refs.rangePicker.focus();
          }
        } catch (error) {
          //console.log('时间选择器聚焦失败:', error);
        }
      });
    },
  },
  components: { navTop, examEdite, examCopy, empty, secondNav }
}
</script>

<style scoped>
.searchlist>>>.el-range__close-icon {
  display: inline-block !important;
  opacity: 1 !important;
}

.main {
  box-sizing: border-box;
  background: #F4F7FD;
  min-height: 100vh;
}

/* .main::-webkit-scrollbar {
		 height:8px;
		background-color: #eee;
		border-radius:10px;
	}
	.main::-webkit-scrollbar-track {
		background-color: #eee;
		border-radius:10px;
	}
	.main::-webkit-scrollbar-thumb {
		background: #619CF5;
		border-radius: 10px;
	} */
.contentMain {
  width: auto;
  padding: 0 0px 0px;
  margin: 0 auto;
  /* height:calc(100vh - 400px); */
  /* position:relative */
}

.contentboxset {
  background: #fff;
  height: 32px;
  border-top: solid 2px #F4F7FD
}

.breadBox {
  width: 1440px;
  margin: 0 auto;
  min-width: 1200px;
  line-height: 32px;
}

.el-breadcrumb {
  width: auto;
  margin: 0 auto;
  line-height: 30px;
  font-size: 14px;
}

.el-breadcrumb__inner a,
.el-breadcrumb__inner.is-link {
  color: #B3B8C2
}

.searchlist {
  box-sizing: border-box;
  width: auto;
  background: #FFFFFF;
  border-radius: 10px;
  padding: 15px 24px;
  align-items: center;
  margin: 14px 0px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.searchlist span {
  font-size: 16px;
  color: #557292;
}

.searchlist .el-select {
  width: 124px;
  margin-right: 16px;
}

.searchlist>>>.el-input__inner {
  border-radius: 10px;
  height: 35px;
  font-size: 16px;
  line-height: 35px;
  border: 1px solid #D8E4F0;
}

.searchlist>>>.el-range__inner {
  border-radius: 10px;
  height: 35px;
  font-size: 16px;
  line-height: 35px;
  border: 1px solid #D8E4F0;
}

.searchlist>>>.el-range-editor.el-input__inner {
  padding: 0 10px;
}

.searchlist>>>.el-date-editor .el-range__icon {
  font-size: 16px;
  line-height: 35px;
  display: none;
}

.searchlist>>>.el-date-editor .el-range-input {
  font-size: 16px;
  line-height: 35px;
}

.searchlist>>>.el-date-editor .el-range-separator {
  font-size: 16px;
  line-height: 35px;
}

.searchlist>>>.el-input__icon {
  line-height: 28px;
  font-size: 16px;
  color: #557292;
  font-weight: bold;
  font-size: 14px;
}

.searchlist b {
  width: 124px;
  height: 34px;
  background: #295CFF;
  border-radius: 10px;
  font-size: 16px;
  color: #FFFFFF;
  text-align: center;
  line-height: 34px;
  cursor: pointer;
}

.contentMainlist {
  display: flex;
  justify-content: space-between;
  position: relative;
  width: 1440px;
  ;
  margin: 15px auto 0;
}

.cmlLeft {
  width: 100%;
  height: calc(100vh - 400px);
}

.clrtitle {
  font-size: 16px;
  color: #2A303B;
  position: relative;
  display: block;
  height: 40px;
}

.clrtitle::before {
  content: '';
  position: absolute;
  width: 64px;
  height: 6px;
  background: linear-gradient(90deg, #527BFF 0%, #FFFFFF 100%);
  border-radius: 3px;
  left: 0;
  bottom: 0;
  z-index: 1;
  opacity: 0.5;
}

.clrtitle i {
  position: absolute;
  left: 0;
  bottom: 0;
  font-style: normal;
  z-index: 2
}

.clrdownlost li {
  display: flex;
  justify-content: space-between;
  padding-left: 28px;
  font-size: 14px;
  padding: 6px 0 6px 35px;
  margin-top: 14px;
}

.clrdownlost li:first-child {
  background: url(../../assets/image/school/pdf.jpg) no-repeat;
  background-size: contain
}

.clrdownlost li:last-child {
  background: url(../../assets/image/school/wj.jpg) no-repeat;
  background-size: contain
}

.boxcentercontact {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
}

.boxcentercontact em {
  box-sizing: border-box;
  display: inline-block;
  width: 145px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid #DEE1E7;
  text-align: left;
  font-size: 14px;
  color: #557292;
  padding-left: 36px;
  line-height: 34px;
}

.boxcentercontact em:first-child {
  background: #F2F6FB url(../../assets/image/school/mess.jpg) no-repeat 15px center;
}

.boxcentercontact em:last-child {
  background: #F2F6FB url(../../assets/image/school/bj.jpg) no-repeat 15px center;
}

.cmlLeft ul li {
  display: flex;
  justify-content: space-between;
  background: #fff;
  box-shadow: 0px 4px 16px 0px rgba(85, 114, 146, 0.1);
  border-radius: 10px;
  margin-bottom: 20px;
  align-items: center;
  padding: 24px;
}

.cmlLeft ul li:last-child {
  margin-bottom: 0;
}

.cmlLeft ul li h3 {
  display: flex;
  align-items: center;
  font-size: 18px;
  color: #2A303B;
  padding-bottom: 0px;
}

.cmlLeft ul li h3 span.blue {
  background: rgba(41, 92, 255, 0.04);
  border-radius: 6px;
  border: 1px solid #295CFF;
  color: #295CFF;
  display: inline-block;
  height: 24px;
  line-height: 24px;
  font-size: 12px;
  padding: 0 10px;
  margin-right: 8px;
}

.cmlLeft ul li p {
  display: flex;
  padding: 10px 0;
}

.cmlLeft ul li p span {
  display: inline-block;
  height: 24px;
  line-height: 24px;
  font-size: 12px;
  margin-right: 10px;
  padding: 0 10px;
}

.cmlLeft ul li p span.blue {
  background: rgba(41, 92, 255, 0.04);
  border-radius: 6px;
  border: 1px solid #295CFF;
  color: #295CFF;
}

.cmlLeft ul li p span.green {
  background: rgba(40, 143, 65, 0.04);
  border-radius: 6px;
  border: 1px solid #288F41;
  color: #288F41;
}

.examInfo {
  display: flex;
  align-items: center;
}

.examInfo b {
  font-weight: normal;
  font-size: 14px;
  color: #8E96A4;
  position: relative;
  padding-right: 14px;
  margin-right: 14px;
}

.examInfo b i {
  font-style: normal;
  color: #8E96A4
}

.examInfo b::after {
  content: '';
  width: 1px;
  height: 8px;
  background: #DEE1E7;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.examInfo b:last-child::after {
  content: '';
  width: 1px;
  height: 8px;
  background: #fff;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.examInfo em {
  color: #8E96A4
}

.boxinfostyle {
  display: flex;
  color: #8E96A4;
  font-size: 14px;
  margin-top: 10px;
}

.boxinfostyle i {
  font-style: normal;
  padding-right: 10px;
  margin-right: 10px;
  color: #333
}

.boxinfostyle i::after {
  content: '';
  width: 1px;
  height: 8px;
  background: #DEE1E7;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.boxinfostyle i:last-child::after {
  content: '';
  width: 1px;
  height: 8px;
  background: #fff;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.tyboxset em {
  display: block;
  width: 104px;
  height: 34px;
  border-radius: 10px;
  line-height: 34px;
  font-size: 14px;
  text-align: center;
  cursor: pointer;
}

.tyboxset em:first-child {
  background: #288F41;
  color: #fff;
}

.examfooter {
  width: 100%;
  height: 54px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0px 4px 16px 0px rgba(85, 114, 146, 0.1);
  position: fixed;
  left: 0;
  bottom: 0;
  z-index: 111;
}

.examFootercontent {
  width: 1440px;
  ;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.examFootercontent .totaldata {
  font-size: 14px;
}

.examFootercontent .totaldata i {
  display: inline-block;
  color: #295CFF;
  font-style: normal;
  line-height: 54px;
  padding: 0 3px;
}

.ewmbox {
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin-top: 14px;
}

.ewmbox li {
  box-sizing: border-box;
  width: 145px;
  height: 175px;
  background: #F2F6FB;
  border-radius: 20px;
  text-align: center;
  padding-top: 14px;
}

.ewmbox li i {
  display: block;
  font-size: 14px;
  color: #2A303B;
  font-style: normal;
  padding-top: 5px;
}

.ewmbox li img {
  width: 121px;
  height: 121px;
  border-radius: 10px
}

.boxbslmedu {
  font-size: 12px;
  color: #8E96A4;
  text-align: center;
  padding-top: 44px;
  line-height: 1.8
}

.inputBox>>>.el-input__inner {
  width: 324px;
}

.el-message-box__status.el-icon-warning {
  color: #ec555a !important;
}

.examFootercontent>>>.el-pagination.is-background .el-pager li:not(.disabled).active {
  background-color: #295CFF !important;
}

.header {
  background-color: #f8f8f8;
  text-align: center;
  transition: all 0.3s ease;
  /* 添加过渡效果 */
}

.sticky {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  /* 吸顶时添加阴影 */
}

.el-button--primary {
  background: #ec555a !important
}

.breadBox>>>.el-breadcrumb__inner a,
.breadBox>>>.el-breadcrumb__inner.is-link {
  font-weight: normal
}

.breadBox>>>.el-breadcrumb__item:last-child .el-breadcrumb__inner,
.breadBox>>>.el-breadcrumb__item:last-child .el-breadcrumb__inner a,
.breadBox>>>.el-breadcrumb__item:last-child .el-breadcrumb__inner a:hover,
.breadBox>>>.el-breadcrumb__item:last-child .el-breadcrumb__inner:hover {
  font-weight: bold
}

.el-select-dropdown__item {}

.searchbox {
  display: flex;
  align-items: center;
  margin-top: 10px;
  position: relative;
  width: 390px;
}

.searchbox span {
  display: block;
  width: 60px;
}

.searchbox>>>.el-input__inner {
  width: 324px;
}

.searchbox i {
  display: block;
  position: absolute;
  right: 14px;
  top: 0;
  width: 34px;
  height: 34px;
  line-height: 34px;
  border-left: solid 1px #DCDFE6;
  text-align: center;
  color: #606266
}

.homeworkliststyle {
  box-sizing: border-box;
  background: #fff;
  border-radius: 10px;
  width: 100%;
  padding: 20px;
}

.custom-table {
  width: 100%;
  border: 1px solid rgba(216, 228, 240, 0.34);
  border-radius: 10px;
  border-right: none;
  border-bottom: none;
}

/* 自定义表格内部元素的样式 */
.custom-table>>>.el-table__header-wrapper th {
  background-color: #E8F0FA;
  height: 42px;
  padding: 0;
  text-align: center;
  font-weight: normal
}

.custom-table>>>.el-table__row td {
  height: 42px;
  padding: 0;
  text-align: center;
  border-bottom: none;
  border-right: solid 1px rgba(216, 228, 240, 0.34);
  font-size: 14px;
}

.el-table .warning-row {
  background: #ffffff;
}

.el-table .success-row {
  background: #D8E4F0;
}

.homeworkliststyle>>>.el-table {
  overflow: inherit;
}

.homeworkliststyle>>>.el-table .cell {
  overflow: inherit;
}

.homeworkliststyle>>>.el-table__body-wrapper {
  overflow: inherit;
}

.boxsettimetitle h3 {
  font-size: 18px;
  color: #2A303B;
}

.boxsettimetitle p {
  font-size: 14px;
  color: #8E96A4;
  padding: 5px 0 10px;
}

.boxsettimetitle>>>.el-table .cell {
  overflow: inherit;
}

.Generatecomparativeanalysis {
  position: fixed;
  left: 0;
  top: 0;
  background: rgba(0, 0, 0, 0.5);
  width: 100%;
  height: 100%;
  z-index: 112;
}

.GeneratecomparativeanalysisContent {
  background: #fff;
  position: fixed;
  width: 430px;
  padding: 30px;
  left: 50%;
  top: 50%;
  z-index: 113;
  transform: translate(-50%, -50%);
  border-radius: 10px;
}

.GeneratecomparativeanalysisContent h3 {
  font-size: 18px;
  font-weight: normal
}

.GeneratecomparativeanalysisContent span {
  display: block;
  font-size: 14px;
  padding: 20px 0 10px
}

.GeneratecomparativeanalysisContent>>>.el-input {
  width: 430px;
}

.GeneratecomparativeanalysisContent>>>.el-input__inner {
  width: 100%;
  height: 34px;
  border-radius: 10px;
}

.GeneratecomparativeanalysisContent>>>.el-input__icon {
  line-height: 34px;
}

.buttonbox {
  padding-top: 15px;
}

.buttonbox em {
  display: inline-block;
  width: 124px;
  height: 34px;
  background: #295CFF;
  border-radius: 10px;
  font-size: 14px;
  color: #FFFFFF;
  text-align: center;
  line-height: 34px;
  cursor: pointer;
}

.buttonbox em:last-child {
  background: #F2F6FB;
  border-radius: 10px;
  border: 1px solid #295CFF;
  color: #295CFF;
  margin-left: 24px;
}

.qxboxset {
  display: flex;
  justify-content: center
}

.qxboxset div {
  margin-left: 14px;
  position: relative;
  margin: 5px 3px 8px;
}

.qxboxset div span {
  display: inline-block;
  border-radius: 10px;
  padding: 5px 15px;
  background-color: #295CFF;
  border-color: #295CFF;
  font-size: 14px;
  color: #fff;
  cursor: pointer;
}

.qxboxset div span.errorred {
  background-color: #EC555A;
  border-color: #EC555A;
}

.qxboxset div ul {
  width: 157px;
  height: auto;
  background: rgb(253, 253, 254);
  box-shadow: 0 4px 16px 0 rgba(85, 114, 146, 0.3);
  border-radius: 10px;
  position: absolute;
  left: 0;
  top: 40px;
  z-index: 9999;
  padding: 10px 0;
}

.qxboxset div ul b {
  font-size: 14px;
  color: #2A303B;
  font-weight: 500;
  padding: 0 14px;
  line-height: 34px;
}

.qxboxset div:last-child ul {
  left: inherit;
  right: 0;
}

.qxboxset div ul li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px;
  line-height: 34px;
  font-size: 14px;
  color: #666666;
  cursor: pointer;
}

.qxboxset div ul li:hover {
  background: rgb(244, 247, 253);
  color: #295CFF
}

.qxboxset div ul li span {
  display: inline-block;
}

.qxboxset div ul li i {
  font-style: normal;
}

.qxboxset div div.phoneimagecontent {
  box-sizing: border-box;
  width: 160px;
  height: 180px;
  background: #FFFFFF;
  box-shadow: 0 4px 16px 0 #5572921a;
  border-radius: 10px;
  text-align: center;
  padding: 12px 0 8px;
  position: absolute;
  left: -15px;
  z-index: 99;
}

.qxboxset div div.phoneimagecontent img {
  width: 136px;
  height: 136px;
}

.qxboxset div div.phoneimagecontent b {
  display: block;
  font-size: 14px;
  color: #666666;
}

.loading-text {
  width: 105px;
  height: 31px;
  box-sizing: border-box;
  border-radius: 10px;
  background: #dcdcdc;
  color: #333;
  line-height: 34px;
}

.dataicon {
  position: absolute;
  right: 0;
  width: 34px;
  height: 35px;
  border-left: solid 1px #D8E4F0;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.dataicon img {
  width: 14px;
  height: 14px;
}

.tablestyle {
  width: 100%;
  text-align: center;
  font-size: 14px;
  border-radius: 10px 10px 0 0;
  border-left: solid 1px rgba(216, 228, 240, 0.34);
  border-top: solid 1px rgba(216, 228, 240, 0.34);
}

.tablestyle th {
  height: 42px;
  line-height: 42px;
  background: rgb(216, 228, 240);
  color: rgb(42, 48, 59);
  font-weight: 500;
  border-bottom: solid 1px rgba(216, 228, 240, 0.34);
  border-right: solid 1px rgba(216, 228, 240, 0.34);
}

.tablestyle th:first-child {
  border-radius: 10px 0 0 0;
}

.tablestyle th:last-child {
  border-radius: 0 10px 0 0;
}

.tablestyle td {
  height: 42px;
  text-align: center;
  border-bottom: solid 1px rgba(216, 228, 240, 0.34);
  border-right: solid 1px rgba(216, 228, 240, 0.34);
}

/* 日期选择器弹出层向上展开 */
.date-picker-popper-top {
  transform: translateY(-10px) !important;
  z-index: 9999 !important;
}

.date-picker-popper-top .el-picker-panel {
  margin-bottom: 10px !important;
}

/* 强制样式覆盖 */
.el-picker-panel.el-date-picker.el-popper.date-picker-popper-top {
  z-index: 9999 !important;
}

.dotting {
  display: inline-block;
  min-width: 2px;
  min-height: 2px;
  box-shadow: 2px 0 currentColor, 6px 0 currentColor, 10px 0 currentColor;
  /* for IE9+, ..., 3个点 */
  animation: dot 4s infinite step-start both;
  /* for IE10+, ... */
  *zoom: expression(this.innerHTML='...');
  /*  for IE7. 若无需兼容IE7, 此行删除 */
}

.dotting:before {
  content: '...';
}

/* for IE8. 若无需兼容IE8, 此行以及下一行删除*/
.dotting::before {
  content: '';
}

/* for IE9+ 覆盖 IE8 */
:root .dotting {
  margin-right: 8px;
}

/* for IE9+,FF,CH,OP,SF 占据空间*/

@keyframes dot {
  25% {
    box-shadow: none;
  }

  /* 0个点 */
  50% {
    box-shadow: 2px 0 currentColor;
  }

  /* 1个点 */
  75% {
    box-shadow: 2px 0 currentColor, 6px 0 currentColor;
    /* 2个点 */
  }
}
</style>
